layui.use('element', function() {
	var $ = layui.jquery,
		element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

	//触发事件
	var active = {
		tabChange: function() {
			//切换到指定Tab项
			element.tabChange('demo', '22'); //切换到：用户管理
		}
	};

});
var demo2 = xmSelect.render({
	el: '#demo5',
	tree: {
		show: true,
		expandedKeys: true,
	},
	height: 'auto',
	height: 'auto',
	data() {
		return [{
				name: '销售员',
				value: -1,
				children: [{
						name: '张三',
						value: 100,
						children: []
					},
					{
						name: '李四1',
						value: 2
					},
					{
						name: '王五1',
						value: 3
					},
				]
			},
			{
				name: '奖品',
				value: -2,
				children: [{
						name: '奖品3',
						value: -3,
						children: [{
								name: '苹果3',
								value: 14
							},
							{
								name: '香蕉3',
								value: 15
							},
							{
								name: '葡萄3',
								value: 16
							},
						]
					},
					{
						name: '苹果2',
						value: 4
					},
					{
						name: '香蕉2',
						value: 5
					},
					{
						name: '葡萄2',
						value: 6
					},
				]
			},
		]
	}
})
var demo2 = xmSelect.render({
	el: '#demo4',
	tree: {
		show: true,
		expandedKeys: true,
	},
	height: 'auto',
	data() {
		return [{
				name: '销售员',
				value: -1,
				children: [{
						name: '张三',
						value: 100,
						children: []
					},
					{
						name: '李四1',
						value: 2
					},
					{
						name: '王五1',
						value: 3
					},
				]
			},
			{
				name: '奖品',
				value: -2,
				children: [{
						name: '奖品3',
						value: -3,
						children: [{
								name: '苹果3',
								value: 14
							},
							{
								name: '香蕉3',
								value: 15
							},
							{
								name: '葡萄3',
								value: 16
							},
						]
					},
					{
						name: '苹果2',
						value: 4
					},
					{
						name: '香蕉2',
						value: 5
					},
					{
						name: '葡萄2',
						value: 6
					},
				]
			},
		]
	}
})
function query(){
		alert("查询")
	}
	function reset() {
		document.getElementById('demoReload').value = ''
		document.getElementById('demoReload1').value = ''
		document.getElementById('demoReload2').value = ''
	}
let data = [{
	"number": "1",
	"processname": "费用申请",
	"currentnode": "财务审核",
	"dcumentno ": "123456789",
	"nowhandler": "李四",
	"processstatus": "进行中",
	"elapsedtime": "4小时20分钟"
}]

layui.use(['form', 'table', 'layedit', 'laydate'], function() {
	var form = layui.form,
		layer = layui.layer,
		layedit = layui.layedit,
		laydate = layui.laydate;
	var table = layui.table;

	table.render({
		elem: '#test',
		data: data,
		cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
			,
		cols: [
			[{
					field: 'number',
					title: '序号'
				}, {
					field: 'currentnode',
					title: '当前流程节点'
				}, {
					field: 'processname',
					title: '流程名称'
				}, {
					field: 'dcumentno ',
					title: '单据号',
					event: 'dcumentNo',
					style: 'cursor: pointer;'
				}, {
					field: 'nowhandler',
					title: '当前处理人'
				} //minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
				, {
					field: 'elapsedtime',
					title: '已用时'
				},
				{
					field: 'processstatus',
					title: '流程状态'
				}, {
					fixed: 'right',
					title: '操作',
					toolbar: '#barDemo'
				}
			]
		],
		page: true
	})
	let data1 = [{
		"number": "1",
		"processname": "费用申请",
		"processtemplate": "财务审核",
		"dcumentno ": "123456789",
		"nowhandler": "李四",
		"initiationtime": "2021-08-21 08:20",
		"completiontime": "2021-08-21 08:20",
		"timeconsuming": "4小时20分钟"
	}]
	table.render({
		elem: '#test1',
		data: data1,
		cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
			,
		cols: [
			[{
					field: 'number',
					title: '序号'
				}

				, {
					field: 'processname',
					title: '流程名称'
				}, {
					field: 'processtemplate',
					title: '流程模板'
				}, {
					field: 'dcumentno ',
					title: '单据号',
					event: 'dcumentNo',
					style: 'cursor: pointer;'
				}, {
					field: 'initiationtime',
					title: '发起时间'
				} //minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
				, {
					field: 'completiontime',
					title: '完成时间'
				},
				{
					field: 'timeconsuming',
					title: '耗时'
				}
			]
		],
		page: true
	})
	let data2 = [{
		"number": "1",
		"processname": "费用申请",
		"processtemplate": "财务审核",
		"dcumentno ": "123456789",
		"nowhandler": "李四",
		"initiationtime": "2021-08-21 08:20",
		"voidtime": "2021-08-24 08:20",
	}]
	table.render({
		elem: '#test2',
		data: data2,
		cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
			,
		cols: [
			[{
					field: 'number',
					title: '序号'
				}

				, {
					field: 'processname',
					title: '流程名称'
				}, {
					field: 'processtemplate',
					title: '流程模板'
				}, {
					field: 'dcumentno ',
					title: '单据号',
					event: 'dcumentNo',
					style: 'cursor: pointer;'
				}, {
					field: 'initiationtime',
					title: '发起时间'
				} //minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
				, {
					field: 'voidtime',
					title: '作废时间'
				}
			]
		],
		page: true
	})
	//监听行单击事件（双击事件为：rowDouble）
	table.on('row(test)', function(obj) {
		parent.layui.index.openTabsPage('views/jsp/Processcenter/jindujiedian.jsp', '整体进度节点');
	});
});
